package com.demo.work.freemarker.model;

import com.demo.work.freemarker.FreeMarkerHelper;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.List;

/**
 * @author liuya
 */
@Data
@Accessors(chain = true)
public class EquipmentTypesTeplate extends JavaTemplateModel{

    private String comment;

    private String author;

    private boolean swagger;

    private List<FieldItem> fields;

    public EquipmentTypesTeplate() {
        setTemplateFileName("class.java.ftl");
    }

    @Data
    public static class FieldItem {
        private String comment;
        private String propertyType;
        private String propertyName;
    }


    public static void main(String[] args) {
        FreeMarkerHelper freeMarkerHelper = new FreeMarkerHelper();
        // 设置模板存放路径
        freeMarkerHelper.setTemplateModule("").setTemplatePackage("freemarker.templates");
        // 设置输出路径
        freeMarkerHelper.setOutputRootPath("E:\\tmp\\TempDemo").setOutputModule("").setOutputBasePackage("com.demo.work");
        // 初始化配置
        freeMarkerHelper.init();

        // 初始化模板数据
//        HelloDataModel helloDataModel = new HelloDataModel()
//                .setClassPath(freeMarkerHelper.getOutputBasePackage())
//                .setHelloWorld("通过简单的 <代码自动生产程序> 演示 FreeMarker的HelloWorld！");
//        helloDataModel.setClassName("Hello");

        EquipmentTypesTeplate e = new EquipmentTypesTeplate();


        // 生成
//        freeMarkerHelper.generate(helloDataModel);

    }

}
